package com.xxx.method;

import java.util.Comparator;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/26  14:35
 * @Copyright
 */
public class Methodre {
    public static void main(String[] args) {
//        m1();
//        m2();
//        m3();
//        m4();

    }

    private static void m4() {
        //         Student student = new Student();
        Supplier<Student> supplier = new Supplier<Student>() {
            @Override
            public Student get() {
                return new Student();
            }
        };
        Supplier<Student> runnable = () -> new Student();
        Supplier<Student> runnable1 = Student::new;
    }


    private static void m3() {
        final Function<Double, Long> function = new Function<Double, Long>() {
            @Override
            public Long apply(Double aDouble) {
                return Math.round(aDouble);
            }
        };
//        System.out.println(function.apply(3.66));
//        Function<Double, Long> functions = d -> Math.round(d);
        Function<Double, Long> functionss = Math::round;
        functionss.apply(3.66);
    }


    private static void m2() {
        Comparator<Integer> comparator = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        };
    }


    private static void m1() {
        final Consumer<String> consumer = new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println("s = " + s);
            }
        };
        //consumer.accept("sss");
//        Consumer<String> tConsumer = s -> System.out.println(s);
//        tConsumer.accept("ss");
        Consumer<String> runnable = System.out::println;
        runnable.accept("sssss");
    }
}
